let lines = ['192.168.1.1', '192.168.1.2', '192.168.1.1', '192.168.1.2']

const findMost = (arr) => {
  let obj = {}, max = 1, val = ''

  for (let i = 0; i < arr.length; i++) {
    const item = arr[i]

    if (item in obj) {
      obj[item] = obj[item] + 1

      if (obj[item] > max) {
        max = obj[item]
        val = item
      }

    } else {
      obj[item] = 1
    }
  }
  return val

  // let ip = '', max = 0
  // for (let key in obj) {
  //   if (obj[key] > max) {
  //     max = obj[key]
  //     ip = key
  //   }
  // }
  // return ip

}

console.log(findMost(lines));